﻿
window.onload = function () {
    setTableFunction('dxgvTable');
}

//设置table tr滑动效果
function setTableFunction(selector) {
    if (typeof (selector) == 'undefined' || selector == null) {
        return;
    }
    if (mySelector(selector).Disable_RowOverOut_ColorChange) {
        return;
    }

    var table = mySelector(selector);
    //onmouseover    
    var trs = table.getElementsByTagName('tr');
    for (var i = 0; i < trs.length; i++) {
        if (i == 0) { continue;} //第一行默认为表头不设置
        trs[i].onmouseover = function () {
            this.style.backgroundColor = "#D3D3D3";
        };
    }    
    //onmouseout
    for (i = 0; i < trs.length; i++) {
        if (i == 0) { continue; }//第一行默认为表头不设置
        trs[i].onmouseout = function () {
            this.style.backgroundColor = "#FFFFFF";
        };
    }

}

function mySelector(selector) {

    var obj;
    if (document.getElementById(selector)) {
        obj = document.getElementById(selector);
        return obj;
    }
    if (document.getElementsByClassName(selector)) {
        obj = document.getElementsByClassName(selector)[0];
        return obj;
    }
    if (document.getElementsByTagName(selector)) {
        obj = document.getElementsByTagName(selector)[0];
        return obj;
    }
}